<template>
	<view class="content">
		<view class="navbar">
			<view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{current: tabCurrentIndex === index}" @click="tabClick(index)">
				{{item.text}}
			</view>
		</view>
	
		<swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab">
			<swiper-item class="tab-content" v-for="(tabItem,tabIndex) in navList" :key="tabIndex">
				<scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData('add')">
					
					<!-- 订单列表 -->
					<view v-for="(item,index) in orderList" :key="index" class="order-item">
						<view class="i-top b-b">
							<text class="time">{{item.createTime | formatDateTime}}</text>
							<text class="state" :style="{color: '#fa436a'}">{{item.status | formatStatus}}</text>
							<text v-if="item.status===1||item.status===2" class="del-btn iconfont icon-shanchu" @click="deleteOrder(item.orderSn)"></text>
						</view>
						<view class="product-list" v-for="(orderItem, itemIndex) in item.orderItemEntityList" :key="itemIndex"  @click="showOrderDetail(item.orderSn)">
							<!--商品列表-->
							<product-order :item="orderItem"></product-order>
						</view>
	
						<view class="price-box">
							共
							<text class="num">{{calcTotalNumber(item)}}</text>
							件商品 实付款
							<text class="price">{{item.totalAmount}}</text>
						</view>
						<view class="action-box b-t" v-if="item.status == 0">
							<button class="action-btn" @click="cancelOrder(item.orderSn)">取消订单</button>
							<button class="action-btn recom" @click="payOrder(item.orderSn)">立即付款</button>
						</view>
						<view class="action-box b-t" v-if="item.status == 1">
							<button class="action-btn recom" @click="showRes(item.orderSn)">查看商品</button>
						</view>
					</view>
	
					<uni-load-more :status="loadingType"></uni-load-more>
	
				</scroll-view>
			</swiper-item>
		</swiper>
	</view>
</template>

<script src = "./list.js"></script>

<style lang="scss" src = "./list.scss"></style>
